//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.example.service;

import cn.hutool.core.date.DateUtil;
import com.example.entity.Notification;
import com.example.mapper.NotificationMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.Iterator;
import java.util.List;

@Service
public class NotificationService {
    @Resource
    private NotificationMapper notificationMapper;

    public NotificationService() {
    }

    public void add(Notification notification) { //管理员不需要注册只需要新增，只有管理员才能增加管理员
        this.notificationMapper.insert(notification);
    }

    public void updateById(Notification notification) {
        this.notificationMapper.updateById(notification);
    }

    public void deleteById(Integer id) {
        this.notificationMapper.deleteById(id);
    }

    public void deleteBatch(List<Integer> ids) {
        Iterator var2 = ids.iterator();

        while(var2.hasNext()) {
            Integer id = (Integer)var2.next();
            this.deleteById(id);
        }

    }

    public Notification selectById(Integer id) {
        return this.notificationMapper.selectById(id);
    }

    public List<Notification> selectAll(Notification notification) {
        return this.notificationMapper.selectAll(notification);
    }

    public List<Notification> selectList(Notification notification) {
        System.out.println(notification);
        return null;
    }

    public PageInfo<Notification> selectPage(Notification notification, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Notification> list = this.notificationMapper.selectAll(notification);
        return PageInfo.of(list);
    }

    public List<Notification> selectByClubIds(List<Integer> clubIds) {
        return notificationMapper.selectByClubIds(clubIds);
    }
}
